<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Role_user extends Model
{
    //
	protected $table='role_user';
	protected $fillable=['user_id','role_id'];
	protected $hidden=[];

	public function allRole($user_id){
		return $this->where('user_id',$user_id)->pluck('role_id');
	}

	public function allRoles($user_id){
		return $this->where('user_id',$user_id)->with('roles')->get();
	}

	public function roles(){
		return $this->belongsTo('App\Model\Role','role_id');
	}

}
